package erwiki.api.workflow;

import org.eclipse.e4.core.contexts.EclipseContextFactory;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.osgi.framework.BundleContext;
import org.osgi.framework.FrameworkUtil;
import org.osgi.service.event.Event;
import org.osgi.service.event.EventAdmin;

final class EventAdminHelper {

	static EventAdmin eventAdmin;

	static {
		BundleContext bundleContext = FrameworkUtil.getBundle(EventAdminHelper.class).getBundleContext();
		IEclipseContext eclipseCtx = EclipseContextFactory.getServiceContext(bundleContext);
		eventAdmin = eclipseCtx.get(EventAdmin.class);
	}

	static void sendEvent(Event event) {
		eventAdmin.sendEvent(event);
	}

}
